﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ClassTester;

namespace ArtesisExamenEvaluator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.FormBorderStyle= FormBorderStyle.FixedSingle;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;

            Gewichten frm = new Gewichten((int) numQuestions.Value);
            
            frm.StartPosition = FormStartPosition.CenterParent;
            
            frm.ShowDialog();

          

            try
            {

                SaveFileDialog dlg = new SaveFileDialog();
                dlg.FileName = "myeval";
                dlg.Filter = "Excel sheet|*.xlsx";

                DialogResult dr= dlg.ShowDialog();   
                if(dr == DialogResult.OK)
                {
                    ToetsEvalCreator.CreateExcel(dlg.FileName, (int)numAmStudents.Value, frm.gewichten,true,"exam eval",true);
                    MessageBox.Show("Klaar", "Hoera", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show("Iets ging verkeerd.\n\rGelieve de onderstaande boodschap naar de auteur(s) te mailen:\n\r" + ex.Message, "Oops", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            button1.Enabled = true;
        }

        private void btnInterpretatie_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(@"Images\Interpretatie.pdf");
        }


    }
}
